<template>
  <div class="map-content" id="map"></div>
</template>

<script>
export default {
  data() {
    return {
      code: "",
      xMap: null,
      options: {
        id: "map",
        center: [154.4, 38.4],
        serverAddr: "http://chart.xnuorui.com/mixinApi",
        userKey: "inuorui",
      },
    };
  },
  methods: {
    codeRun(code) {
      this.code = code;
      try {
        eval(code);
      } catch {
        this.$message.error("语法存在错误，请检查你的代码");
      }
    },
    initMap() {
      // eslint-disable-next-line no-undef
      this.xMap = new xnrMap();
      this.xMap.initMap(this.options);
    },
  },
  mounted() {
    this.initMap();
  },
};
</script>

<style scoped lang="scss">
.map-content {
  width: 100%;
  height: 100%;
  background-color: #a3ccff;
}
</style>
